<% if @user %>
<h2><%=@user.login.capitalize%>'s groups</h2>
<a href="/group/edit" class="button">Create a group</a>
<hr>
<script>var evenodd=false;</script>
<div class="account-table">
<table>
<thead><th>Group</th><th>Description</th><th>Moderator</th></thead>
<tbody>
<% @results.each do |group| %>
<script>if (evenodd) document.write('<tr class="evenrow">'); else document.write('<tr class="oddrow">'); 
evenodd = !evenodd;</script>
  <td><a href="<%= link group.uid, 'group' %> "><%=group.title%></a></td>
  <td> <%=group.description%> </td>
   <td><%=User.find_by_id(group.sponsor).login  %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
<% end %>